// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 添加用户 */
export async function createUser(options) {
  return request<{
    data;
  }>('/api/sysUser/add', {
    method: 'POST',
    data:(options || {}),
  });
}

/** 删除用户 */
export async function deleteUser(options) {
    return request<{
      data;
    }>('/api/sysUser/delete', {
      method: 'GET',
      params:(options || {}),
    });
  }
  
  /** 用户列表 */
export async function fetchUserList(options) {
   const result = await request('/api/sysUser/queryPage', {
      method: 'POST',
      data: options,
    });
    return { data: result.data.records, success: true, total:result.data.total }
  }
  
  // 更新用户
export async function updateUser(options) {
    console.log(options)
    return request<{
      data;
    }>('/api/sysUser/update', {
      method: 'POST',
      data:(options || {}),
    });
  }



export async function getUserSelect() {
  const result = await request('/api/sysUser/userSelect', {
    method: 'POST',
  });
  return result
}



/** 添加用户 */
export async function createClientUser(options) {
  return request<{
    data;
  }>('/api/sysUser/add', {
    method: 'POST',
    data:(options || {}),
  });
}

/** 删除用户 */
export async function deleteClientUser(options) {
    return request<{
      data;
    }>('/api/mjUser/delete', {
      method: 'GET',
      params:(options || {}),
    });
  }
  
  /** 用户列表 */
export async function fetchClientUserList(options) {
    console.log(options,'--')
   const result = await request('/api/mjUser/queryPage', {
      method: 'POST',
      data: options,
    });
    return { data: result.data.records, success: true,total:result.data.total }
  }
  
  // 更新用户
export async function updateClientUser(options) {
    console.log(options)
    return request<{
      data;
    }>('/api/mjUser/update', {
      method: 'POST',
      data:(options || {}),
    });
  }
  
  // 重置用户密码
export async function resetPassword(options) {
    console.log(options)
    return request<{
      data;
    }>('/api/sysUser//resetPassword', {
      method: 'GET',
      params:(options || {}),
    });
  }
  //用户详情
  export async function detailUser(id) {
    return request('/api/mjUser/detail', {
      method: 'GET',
      params:{id},
    });
  }